#include <iostream>
#include <vector>
using std::vector;
using std::cout;
using std::endl;

class Point{
public:
    Point(int x,int y)
        :_x(x)
         ,_y(y)
    {
        cout << "Point(int,int)" << endl;
    }

    Point(const Point & rhs)
        :_x(rhs._x)
         ,_y(rhs._y)
    {
        cout << "Point(const Point &)" << endl;
    }

    ~Point(){
        cout << "~Point()" << endl;
    }

private:
    int _x;
    int _y;
};

void test1(){

    vector<Point>numbers;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
#if 0
    numbers.pop_back();
    numbers.pop_back();
    numbers.pop_back();
    numbers.shrink_to_fit();
    numbers.clear();
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    for(auto & num : numbers){
        cout << num ;
    }
    cout << endl;
#endif
}


void test2(){

    vector<Point>numbers;
    numbers.reserve(10);
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.push_back(Point(1,2));
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
#if 0
    cout << "------------" << endl;
    for(auto & num : numbers){
        cout << num ;
    }
    cout << endl;
    cout << "------------" << endl;
    auto it1 = numbers.begin();
    auto it2 = numbers.end();
    //vector<int>::iterator it2 = number.end();
    while(it1 != it2){
        cout << *it1 ;
        ++it1;
    }
    cout << endl;
    cout << "------------" << endl;
    for(size_t i = 0;i < numbers.size();i++){
        cout << numbers[i]; 
    }
    cout << endl;
#endif
}

void test3(){

    vector<Point>numbers;
    numbers.reserve(10);
    numbers.emplace_back(1,2);
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.emplace_back(1,2);
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.emplace_back(1,2);
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.emplace_back(1,2);
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
    numbers.emplace_back(1,2);
    cout << numbers.size() << endl;
    cout << numbers.capacity() << endl;
}


int main()
{
    test3();
    return 0;
}

